﻿using Common;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using Microsoft.AspNetCore.Authorization;
using User;

namespace GrpcServer_Demo.Services;

public class InterServices : inter.InternalService.InternalServiceBase
{
    //[Authorize(Roles = GlobalConst.AdminPolicy)]
    [Authorize(Policy = GlobalConst.AdminPolicy)]
    public override Task<SafeCallResponse> InternalCall(Empty request, ServerCallContext context)
    {
        return Task.FromResult(new SafeCallResponse() { HeaderValue = context.RequestHeaders.Get("caller-user")?.Value ?? "null" });
    }
}